package com.blast.comicsisland.activity;

import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.blast.comicsisland.R;
import com.blast.comicsisland.utils.ShareUtil;

/**
 * 用于测试一键分享的功能，最后删除即可
 */
public class MineActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mine);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_mine, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**
     * 一键分享APP
     * @param view
     */
    public void btnShareStringOnClick(View view) {
        ShareUtil.shareString(this, Environment.getExternalStorageDirectory()+"/icon.png");
    }

    /**
     * 一键分享具体的内容
     * @param view
     */
    public void btnShareUrlOnClick(View view) {
        ShareUtil.shareUrl(this, "https://www.baidu.com/img/bdlogo.png", "biaoti", "hahahahaha");
    }
}
